/*
 * 1.54 TFT, 240x240, ST7789V driver ic, spi interface
 * LCM outline size 31.5(H)x33.72(V)
 * Active area 27.72(H)x27.72(V)
 * If=60mA(type), Vf=3.2(type)
 * ---------------------------------------------
 * pin  -   description
 * 1    -   GND
 * 2    -   LEDK
 * 3    -   LEDA
 * 4    -   VDD
 * 5    -   GND
 * 6    -   GND
 * 7    -   D\C
 * 8    -   CS
 * 9    -   SCL
 * 10   -   SDA
 * 11   -   RESET
 * 12   -   GND
 * ---------------------------------------------
 * 
 */
#ifndef LCD_154HSC04A_H
#define LCD_154HSC04A_H

#include "lcd.h"
#include "hal_drv.h"
#include "st7789_v2_reg.h"

typedef struct
{
    void *bus_handle;
    lcd_bus_t *bus;

    lcd_base_t base;
    
    uint16_t x_offset;
    uint16_t y_offset;
    
    SemaphoreHandle_t draw_complete;
    
}lcd_154hsc04a_t;


extern void lcd_154hsc04a_init(lcd_154hsc04a_t *t);
extern void lcd_154hsc04a_reg_init(lcd_154hsc04a_t *t);
extern void lcd_154hsc04a_rotation(lcd_154hsc04a_t *t, uint16_t angle);
extern void lcd_154hsc04a_draw_rect(lcd_154hsc04a_t *t, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, const uint8_t *color_p);
extern void lcd_154hsc04a_draw_end(lcd_154hsc04a_t *t);
extern void lcd_154hsc04a_draw_complete_wait(lcd_154hsc04a_t *t);
extern void lcd_154hsc04a_clear(lcd_154hsc04a_t *t, uint16_t color);
extern void lcd_154hsc04a_cmd(lcd_154hsc04a_t *t, uint8_t cmd);
#endif /* LCD_154HSC04A_H */
